Polytypic Functions Over Nested
نویسنده
چکیده
The theory and practice of polytypic programming is intimately connected with the initial algebra semantics of datatypes. This is both a blessing and a curse. It is a blessing because the underlying theory is beautiful and well developed. It is a curse because the initial algebra semantics is restricted to so-called regular datatypes. Recent work by R. Bird and L. Meertens (1998) on the semantics of non-regular or nested datatypes suggests that an extension to general datatypes is not entirely straightforward. Here we propose an alternative which extends polytypism to arbitrary datatypes, including nested datatypes and mutually recursive datatypes. The central idea is to use rational trees over a suitable set of functor symbols as index sets for polytypic functions. Besides covering a wider range of types the approach is also simpler and technically less involving than previous ones. The prize one has to pay is a certain loss in expressiveness: general recursion schemes such as fold and friends can no longer be deened.
منابع مشابه
Polytypic Functions Over Nested Datatypes
The theory and practice of polytypic programming is intimately connected with the initial algebra semantics of datatypes. This is both a blessing and a curse. It is a blessing because the underlying theory is beautiful and well developed. It is a curse because the initial algebra semantics is restricted to so-called regular datatypes. Recent work by R. Bird and L. Meertens [3] on the semantics ...
متن کاملPolytypic Functions over Nested Datatypes (extended Abstract)
The theory and practice of polytypic programming is intimately connected with the initial algebra semantics of datatypes. This is both a blessing and a curse. It is a blessing because the underlying theory is beautiful and well developed. It is a curse because the initial algebra semantics is restricted to so-called regular datatypes. Recent work by R. Bird and L. Meertens 1] on the semantics o...
متن کاملPolytypic Programming With Ease
A functional polytypic program is one that is parameterised by datatype. Since poly-typic functions are deened by induction on types rather than by induction on values they typically operate on a higher level of abstraction than their monotypic counterparts. However, polytypic programming is not necessarily more complicated than conventional programming. We show that a polytypic function is uni...
متن کاملPolytypic Programming
Many functions have to be written over and over again for different datatypes, either because datatypes change during the development of programs, or because functions with similar functionality are needed on diierent datatypes. Examples of such functions are pretty printers, debug-gers, equality functions, uniiers, pattern matchers, rewriting functions, etc. Such functions are called polytypic...
متن کاملFormal polytypic programs and proofs
The aim of our work is to be able to do fully formal, machine verified proofs over Generic Haskellstyle polytypic programs. In order to achieve this goal, we embed polytypic programming in the proof assistant Coq and provide an infrastructure for polytypic proofs. Polytypic functions are reified within Coq as a datatype and they can then be specialized by applying a dependently typed term speci...
متن کامل